﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using FreeSql.DataAnnotations;
using Newtonsoft.Json;

namespace Zzcore.Model
{
    [Table(Name = "user")]
    public class User
    {
        [Column(IsIdentity = true, IsPrimary = true, Name = "id")]
        [JsonProperty("id")]
        public long Id { get; set; }

        [Column(Name = "username")]
        [JsonProperty("username")]
        public string Username { get; set; }

        [Column(Name = "password")]
        [JsonProperty("password")]
        public string Password { get; set; }

        [Column(Name = "realname")]
        [Description("用户姓名")]
        [JsonProperty("realname")]
        public string Realname { get; set; }

        [Column(Name = "worknumber")]
        [Description("工号")]
        [JsonProperty("worknumber")]
        public string WorkNumber { get; set; }

        [Column(Name = "did")]
        [Description("部门ID")]
        [JsonProperty("did")]
        public long Did { get; set; }

        [Column(Name = "rids", IsIgnore = true)]
        [Description("部门ID")]
        [JsonProperty("rids")]
        public List<long> Rids { get; set; }

        [Column(Name = "post")]
        [Description("职位")]
        [JsonProperty("post")]
        public string Post { get; set; }

        [Column(Name = "mail")]
        [Description("邮箱")]
        [JsonProperty("mail")]
        public string Mail { get; set; }

        [Column(Name = "sex")]
        [Description("性别")]
        [JsonProperty("sex")]
        public string Sex { get; set; }

        [Column(Name = "phone")]
        [Description("电话号码")]
        [JsonProperty("phone")]
        public string Phone { get; set; }

        [Column(Name = "avater")]
        [Description("头像")]
        [JsonProperty("avater")]
        public string Avater { get; set; }

        [Column(Name = "visits")]
        [Description("访问次数")]
        [JsonProperty("visits")]
        public long Visits { get; set; }

        [Column(Name = "status")]
        [JsonProperty("status")]
        [Description("状态(禁用、离职等)")]
        public int Status { get; set; }

        [Column(Name = "joindate", DbType = "datetime(0)")]
        [JsonProperty("joindate")]
        [Description("入职时间")]
        public DateTime Joindate { get; set; }

        [Column(Name = "created", ServerTime = DateTimeKind.Local, CanUpdate = false, DbType = "datetime(0)")]
        [JsonProperty("created")]
        public DateTime CreateTime { get; set; }

        [Column(Name= "updated", ServerTime = DateTimeKind.Local, DbType = "datetime(0)")]
        [JsonProperty("updated")]
        public DateTime UpdateTime { get; set; }
    }
}
